from celery import Celery
from django.conf import settings
import os
#设置Celery的环境变量 worker 进程是独立Django独自启动
#需要依赖django的配置文件
os.environ.setdefault('DJANGO_SETTINGS_MODULE',"p6.settings")

#初始化celery对象
app = Celery('worker')
app.conf.broker_url = "redis://@localhost:6379/6"
app.conf.result_backend = "redis://@localhost:6379/7"
#自动发现任务函数
app.autodiscover_tasks(settings.INSTALLED_APPS)
